//
// Created by mouse on 2019/10/8.
//

#include "app_wifi.h"

WiFiClient wiFiClient;

void wifi_connect(const char *ssid, const char *password)
{
    //设置WiFi模式
    WiFi.mode(WIFI_STA);
    //扫描并连接WiFi
    WiFi.begin(ssid, password);
    Serial.printf("\nConnecting to %s ...", ssid);
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(1000);
        Serial.print(".");
    }
    Serial.println();
}

void print_wifi()
{
    Serial.printf("====================================\n");
    Serial.printf("Chip ID: %d\n", ESP.getChipId());
    Serial.printf("ESP8266 mode is: %d\n", WiFi.getMode());
    Serial.printf("MAC address is: %s\n", WiFi.macAddress().c_str());
    Serial.printf("IP is: %s\n", WiFi.localIP().toString().c_str());
    Serial.printf("====================================\n");
}
